// Photo Database routines
// Copyright 2006 (C) Ralph Thomas

#ifndef MISSION_APPS_PHOTO_PHOTODB_H
#define MISSION_APPS_PHOTO_PHOTODB_H

#include <boost/filesystem/path.hpp>

namespace apps {
	namespace photo {
		//
		/// Get the path to the photo library.
		///
		/// \return	the path to the photo library.
		//
		boost::filesystem::path getPhotoLibraryPath();
		//
		/// Get the path to the photo database.
		///
		/// \return	the path to the photo database.
		//
		boost::filesystem::path getPhotoDatabasePath();
		//
		/// Examine the photo metadata database. If it doesn't exist
		/// then it will be created, if it was created by an older
		/// version of Mission Photo then it will be migrated to the
		/// new schema (preserving data). Much of the data in the
		/// metadata database cannot be generated automatically, so
		/// it's vital that the database never dies.
		///
		/// \param	path	the path to the database files.
		/// \return	true if the database was verified to be okay,
		///		false otherwise.
		//
		bool init_database( const boost::filesystem::path& path );
		//
		/// Add a new tag and return it's id in a string. If
		/// the tag already exists then it's id is returned.
		///
		/// \param	tag	the name of the tag.
		/// \return	the id of the tag.
		//
		std::string add_tag( const std::string& tag );
		//
		/// Escape the given string (for SQL) and return it.
		///
		/// \param	source	the string to escape.
		/// \return	source, escaped.
		//
		std::string escape_db( const std::string& source );
	}
}

#endif
